function getCharts(id, type) {
    var myChart = echarts.init(document.getElementById(id));
    var data = [299, 400, 501, 299, 501, 400, 501, 666];
    var data6 = [299, 400, 501, 299, 501, 400, 501, 299, 400, 501, 299, 501, 400, 501, 299, 400, 501, 299, 501, 400, 501];
    var array = [1300, 2300, 3400, 4200, 5100];
    var array1 = [6470, 6470, 6470, 6470, 6470];
    var data2 = [{
        value: 3661,
        name: '<10w',
        itemStyle: {
            normal: {
                color: 'rgba(0,255,255,0.58)',
                borderWidth: 1,
                borderColor: '#00ffff'
            }
        }
    }, {
        value: 5713,
        name: '10w-50w',
        itemStyle: {
            normal: {
                color: 'rgba(55,201,54,0.6)',
                borderWidth: 1,
                borderColor: '#37c936'
            }
        }
    }, {
        value: 9938,
        name: '50w-100w',
        itemStyle: {
            normal: {
                color: 'rgba(248,231,28,0.64)',
                borderWidth: 1,
                borderColor: '#F8E71C'
            }
        }
    }, {
        value: 17623,
        name: '100w-500w',
        itemStyle: {
            normal: {
                color: 'rgba(249,95,182,0.53)',
                borderWidth: 1,
                borderColor: '#f95fb8'
            }
        }
    }, {
        value: 3299,
        name: '>500w',
        itemStyle: {
            normal: {
                color: 'rgba(74,114,255,0.58)',
                borderWidth: 1,
                borderColor: '#4a72ff'
            }
        }
    }];
    //饼图1
    var options1 = {
        backgroundColor: 'none',
        tooltip: {
            trigger: 'item',
            formatter: "{b}: {c}",
        },
        legend: {
            data: _.map(data2, function(item) {return item.name}),
            textStyle: {
                color: '#fff'
            },
            left: 30,
            bottom: 20,
            selectedMode: false
        },
        series: [{
            name: 'pie1',
            type: 'pie',
            center: ['50%', '45%'],
            selectedMode: 'single',
            radius: ['30%', '65%'],
            color: ['#86D560', '#AF89D6', '#59ADF3', '#FF999A', '#FFCC67'],
            label: {
                normal: {
                    formatter: '{d}%',
                    textStyle: {
                        color: '#fff',
                        fontWeight: 'bold',
                        fontSize: 14
                    }
                }
            },
            data: data2
        }]
    };
    //横轴柱状图1
    var options2 = {
        backgroundColor: 'none',
        grid: {
            top: '12%',
            left: '8%',
            right: '8%',
            bottom: '4%',
            containLabel: true //grid 区域包含坐标轴的刻度标签。
        },
        xAxis: [{
            type: 'value',
            axisTick: {
                alignWithLabel: true //柱子剧中对齐
            },
            splitLine: {
                show: false
            },
            axisLabel: {
                show: false
            },
            axisTick: {
                show: false
              },
        }],
        yAxis: [{
            type: 'category',
            data: ['峨眉山', '峨眉山', '峨眉山', '峨眉山', '峨眉山'],
            axisLabel: {
                textStyle: {
                    color: '#9a9bae',
                }, //刻度标签文字颜色
            },
            axisTick: {
                show: false
            }, //取消坐标中间刻度
            axisLine: {
                lineStyle: {
                    color: "#343448"
                }
            },
            splitLine: {
                lineStyle: {
                    color: '#343448',
                }, //坐标轴在 grid 区域中的分隔线颜色
            },
        }],
        series: [{
            name: '月开支',
            type: 'bar',
            barGap: '-100%',
            barWidth: '50%',
            label: {
                normal: {
                    textStyle: {
                        color: '#682d19'
                    },
                    position: 'left',
                    show: false,
                    formatter: '{b}'
                }
            },
            itemStyle: {
                normal: {
                    color: 'rgba(0,255,255,0.1)',
                    borderWidth: 2,
                    borderColor: 'rgba(0,255,255,0.12)'

                }
            },
            data: array1
        }, {
            type: 'bar',
            silent: true,
            barGap: '-100%',
            barWidth: '50%',
            data: array,
            itemStyle: {
                normal: {
                    color: 'rgba(248,231,28,0.64)',
                    borderWidth: 1,
                    borderColor: '#F8E71C'

                }
            },

        }]
    };

    //柱图1
    var options3 = {
        backgroundColor: 'none',
        tooltip: {
            trigger: 'axis',
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'line' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            top: '10%',
            left: '3%',
            right: '4%',
            bottom: '17%',
            containLabel: true //grid 区域包含坐标轴的刻度标签。
        },
        xAxis: [{
            type: 'category',
            data: ['遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市'],
            axisTick: {
                alignWithLabel: true //柱子剧中对齐
            },
            axisLabel: {
                rotate: 45,
                textStyle: {
                    color: '#9a9bae',
                } //刻度标签文字颜色
            }
        }],
        yAxis: [{
            type: 'value',
            axisLabel: {
                textStyle: {
                    color: '#9a9bae',
                }, //刻度标签文字颜色
            },
            axisTick: {
                show: false
            }, //取消坐标中间刻度
            axisLine: {
                lineStyle: {
                    color: "#343448"
                }
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(0,255,255,0.19)',
                }, //坐标轴在 grid 区域中的分隔线颜色
            },
        }],
        series: [{
                name: '2016年',
                type: 'bar',
                barWidth: '40%',
                label: {
                    normal: {
                        show: false,
                        position: 'top',
                        textStyle: {
                            color: '#5b83e5',
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgba(232,118,222,0.53)',
                        borderWidth: 2,
                        borderColor: '#F95FB6'
                    },
                },
                data: data6
            },
            {
                name: '2016年',
                type: 'line',
                barWidth: '28',
                label: {
                    normal: {
                        show: false,
                        position: 'top',
                        textStyle: {
                            color: '#5b83e5',
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: '#B44D92'
                    },
                },
                data: data6
            }
        ]
    };


    if (type == 'pie') {
        myChart.setOption(options1);
    } else if (type == 'bar') {
        myChart.setOption(options2);
    } else if (type == 'bar-a') {
        myChart.setOption(options3);
    }
    window.onresize = myChart.resize;

}